package com.sduept.nwld.dataserver.model.faultforecast;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

import org.apache.commons.lang3.StringUtils;

import com.sduept.bigdata.weather.entity.IceData;
import com.sduept.bigdata.weather.entity.IceMonitor;
import com.sduept.bigdata.weather.entity.SimpleIcingModel;
import com.sduept.generator.ObjectId;

/**
 * 覆冰故障预测样本数据
 */
@Entity
@Table(name="t_ice_fault_sample")
public class IceFaultSample extends SimpleIcingModel implements Serializable,Cloneable{
	
	public IceFaultSample(){}
	public IceFaultSample(IceMonitor monitor,IceData data){
		setId(ObjectId.get().toString());
		setMonitorId(monitor.getBs_id());
		if(StringUtils.isBlank(monitor.getLineCimName())) {
			setLineName(monitor.getLine_name());
		}else {
			setLineName(monitor.getLineCimName());
		}
		setLineId(monitor.getLineCimId());
		setLon(monitor.getLongitude());
		setLat(monitor.getLatitude());
		setPoleName(monitor.getPole_name());
		Double b = new BigDecimal(String.valueOf(data.getRecIceHeight())).doubleValue(); 
		setAveHeight(b);
		setMaxHeight(b);
		setIceRecordCount(1);
		setStartTime(data.getRecUpdateTime());
		setEndTime(data.getRecUpdateTime());
		setDuration(0d);
	}
	public IceFaultSample(IceMonitor monitor){
		setId(ObjectId.get().toString());
		setMonitorId(monitor.getBs_id());
		if(StringUtils.isBlank(monitor.getLineCimName())) {
			setLineName(monitor.getLine_name());
		}else {
			setLineName(monitor.getLineCimName());
		}
		setLineId(monitor.getLineCimId());
		setLon(monitor.getLongitude());
		setLat(monitor.getLatitude());
		setPoleName(monitor.getPole_name());
		setDuration(0d);
	}
	/**
	 * 
	 */
	private static final long serialVersionUID = 4519227448464131730L;
	
	@Id
	private String id;
	
	/**
	 * 本次覆冰时间内，覆冰设备辐射区域内的故障次数
	 */
	private Integer faultNum = 0;
	
	/**
	 * 本条样本数据生成时间
	 */
	private Date recordTime;
	private String faultLons;
	private String faultLats;
	
	/**
	 * 故障id，逗号隔开
	 */
	private String faultIds;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public Integer getFaultNum() {
		return faultNum;
	}

	public void setFaultNum(Integer faultNum) {
		this.faultNum = faultNum;
	}

	public String getFaultIds() {
		return faultIds;
	}
	public void setFaultIds(String faultIds) {
		this.faultIds = faultIds;
	}
	public Date getRecordTime() {
		return recordTime;
	}

	public void setRecordTime(Date recordTime) {
		this.recordTime = recordTime;
	}
	public String getFaultLons() {
		return faultLons;
	}
	public void setFaultLons(String faultLons) {
		this.faultLons = faultLons;
	}
	public String getFaultLats() {
		return faultLats;
	}
	public void setFaultLats(String faultLats) {
		this.faultLats = faultLats;
	}

}
